package com.chia.multienty.core.controller;


import com.chia.multienty.core.domain.condition.UserCondition;
import org.springframework.context.annotation.Conditional;
import org.springframework.web.bind.annotation.RequestMapping;
import com.chia.multienty.core.service.TenantPayLogService;
import com.chia.multienty.core.domain.dto.TenantPayLogDTO;
import com.chia.multienty.core.pojo.TenantPayLog;
import com.chia.multienty.core.parameter.tenant.TenantPayLogDetailGetParameter;
import com.chia.multienty.core.parameter.tenant.TenantPayLogPageGetParameter;
import com.chia.multienty.core.parameter.tenant.TenantPayLogDeleteParameter;
import com.chia.multienty.core.parameter.tenant.TenantPayLogSaveParameter;
import com.chia.multienty.core.parameter.tenant.TenantPayLogUpdateParameter;
import com.chia.multienty.core.parameter.tenant.TenantPayLogEnableParameter;
import com.chia.multienty.core.parameter.tenant.TenantPayLogDisableParameter;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.chia.multienty.core.annotation.WebLog;
import com.chia.multienty.core.domain.basic.Result;
import org.springframework.web.bind.annotation.RestController;
import lombok.RequiredArgsConstructor;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
 * <p>
 * 租户支付日志 服务
 * </p>
 *
 * @author Multi Tenant Auto Generator
 * @since 2024-07-19
 */
@RestController
@Validated
@RequestMapping("/tenant-pay-log")
@RequiredArgsConstructor
@Api(tags = "租户支付日志")
@Conditional(UserCondition.class)
public class TenantPayLogController {

    private final TenantPayLogService tenantPayLogService;

    @PostMapping("/detail")
    @ApiOperation("获取租户支付日志详情")
    public Result<TenantPayLogDTO> getDetail(@Validated @RequestBody TenantPayLogDetailGetParameter parameter) {
        TenantPayLogDTO detail = tenantPayLogService.getDetail(parameter);
        return new Result<>(detail);
    }

    @PostMapping("/page")
    @ApiOperation("获取租户支付日志分页列表")
    public Result<IPage<TenantPayLogDTO>> getPage(@Validated @RequestBody TenantPayLogPageGetParameter parameter) {
        IPage<TenantPayLogDTO> page = tenantPayLogService.getPage(parameter);
        return new Result<>(page);
    }

    @PostMapping("/update")
    @ApiOperation("更新租户支付日志")
    @WebLog(target = "TenantPayLog")
    public Result<Boolean> update(@Validated @RequestBody TenantPayLogUpdateParameter parameter) {
        tenantPayLogService.update(parameter);
        return new Result<>(true);
    }

    @PostMapping("/save")
    @ApiOperation("保存租户支付日志")
    @WebLog(target = "TenantPayLog")
    public Result<Boolean> save(@Validated @RequestBody TenantPayLogSaveParameter parameter) {
        tenantPayLogService.save(parameter);
        return new Result<>(true);
    }

    @PostMapping("/enable")
    @ApiOperation("启用租户支付日志")
    @WebLog(target = "TenantPayLog")
    public Result<Boolean> enable(@Validated @RequestBody TenantPayLogEnableParameter parameter) {
        tenantPayLogService.enable(parameter);
        return new Result<>(true);
    }

    @PostMapping("/disable")
    @ApiOperation("禁用租户支付日志")
    @WebLog(target = "TenantPayLog")
    public Result<Boolean> disable(@Validated @RequestBody TenantPayLogDisableParameter parameter) {
        tenantPayLogService.disable(parameter);
        return new Result<>(true);
    }

    @DeleteMapping("/delete")
    @ApiOperation("删除租户支付日志")
    @WebLog(target = "TenantPayLog")
    public Result<Boolean> delete(@Validated @RequestBody TenantPayLogDeleteParameter parameter) {
        tenantPayLogService.delete(parameter);
        return new Result<>(true);
    }

}
